/**
 * \file
 *           tlmRmtCfgDataInfoAck.cpp
 * \brief
 *           Implements tlmRmtCfgDataInfoAck class for Telematics services
 *           this is the class of Ack data infomation of remote configuration.
 *
 * \par Author (last changes):
 *          - Zeng Jie
 *          - BUIC, Continental Automotive Holdings Co., Ltd.
 * \par Project Leader:
 *          -
 * \par Responsible Developer:
 *          - Zeng Jie
 *          - BUIC, Continental Automotive Holdings Co., Ltd.
 * \par Responsible Architect:
 *          - Zhang Fa
 *          - BUIC, Continental Automotive Holdings Co., Ltd.
 *
 * \par Project:
 *      DPCA2
 *
 * \par SW-Component:
 *      Telematics
 *
 * \par SW-Package:
 *      Telematics
 *
 * \par SW-Module:
 *      Telematics Application
 *
 * \par SW-Architecture Specification:
 *      DPCA2_TELEMATICS_SW_DD_07a_ready.doc
 *
* \par SW-Design Specification:
 *      DPCA2_TLM-RMTCFG_SW_DD_01d_released.doc
 *
 * \par SW-Test Case Specification:
 *
 * \par CM-Info:
 *
 * \note
 *      This is a note.
 *
 * \bug
 *      - there are no known bugs
 *
 * \par Module-History:
 *
 * \verbatim
 * Date                Author					Reason
 * 10 Dec 2013        Zeng Jie              Initial Creation
 * The latest entry at the head of the history list.
 * \endverbatim
 *
 * \par Copyright Notice:
 * Copyright (C) 2012 Continental Automotive Holdings Co., Ltd.
 * Alle Rechte vorbehalten. All Rights Reserved.\n
 * The reproduction, transmission or use of this document or its contents is
 * not permitted without express written authority.\n
 * Offenders will be liable for damages. All rights, including rights created
 * by patent grant or registration of a utility model or design, are reserved.
 *
 */

#include "stdafx.h"


#include "tlmRmtCfgDataInfoAck.h"
#include "tlmRmtCfgSrvApp.h"
//#[ ignore

/**
* \brief tlmRmtCfgDataInfoAck: this is constructor of tlmRmtCfgDataInfoAck class
*
* \note
*
* \param[in]
* - bufptr: pointer to buffer that store the datainfo message
*   size  : size of the datainfo buffer
*
* \return
* - none
*/
tlmRmtCfgDataInfoAck::tlmRmtCfgDataInfoAck(uint8_t* bufPtr, uint32_t size) : tlmRmtCfgDataInfo(bufPtr, size),mStatus(0) {
    //#[ operation tlmRmtCfgDataInfoAck(uint8_t*,uint32_t)
    //#]
}

/**
* \brief tlmRmtCfgDataInfoAck: this is default constructor of tlmRmtCfgDataInfoAck class
*
* \note
*
* \param[in]
* - none
*
* \return
* - none
*/
tlmRmtCfgDataInfoAck::tlmRmtCfgDataInfoAck() {
}

/**
* \brief ~tlmRmtCfgDataInfoAck: this is destructor of tlmRmtCfgDataInfoAck class 
*
* \note
*
* \param[in]
* - none
*
* \return
* - none
*/
tlmRmtCfgDataInfoAck::~tlmRmtCfgDataInfoAck() {
}

/**
* \brief Fill : fill the data info of acknowledge message.
*
* \note
*
* \param[in]
* - none
*
* \return
* - none
*
* [Covers: MRN_TLM-RMTCFG_SW_DD_036]
*/
void tlmRmtCfgDataInfoAck::Fill() {
    //#[ operation Fill()
    //before use Fill(), we must set the dataInfobuffer     
    
    //Init the dataInfo Msg  
    mDataInfoBuffer.reset();     
    
    //the first byte should be 0x7E
    mDataInfoBuffer.setValue(SEPERATE_LEVEL_1); 
              
              
    //set service vin
    //next is 0x10  
    mDataInfoBuffer.setValue(TLM_RMT_CFG_DATA_INFO_CODE_STATUS); 
    mDataInfoBuffer.setValue(mStatus);  
    //#]

	//set the datainfo size
	mDataInfoSize = mDataInfoBuffer.getSize();
}

/**
* \brief GetMaxDataInfoSize: Get the max length of data info of acknowledge message.
*
* \note
*
* \param[in]
* - none
*
* \return
* -  uint32_t : the max data info size
*
*/
uint32_t tlmRmtCfgDataInfoAck::GetMaxDataInfoSize() {
    //#[ operation GetMaxDataInfoSize()
    return  TLM_RMT_CFG_DATA_INFO_ACK_MAX_SIZE;
    //#]
}

/**
* \brief Init: Init the data info of acknowledge message, just set the ack status.
*
* \note
*
* \param[in]
* - none
*
* \return
* - none
*
* [Covers: MRN_TLM-RMTCFG_SW_DD_035]
*/
void tlmRmtCfgDataInfoAck::Init() {
    //#[ operation Init()
    uint8_t status=0x00;
    
    tlmRmtCfgSrvApp * pRmtCfgSrvApp = reinterpret_cast<tlmRmtCfgSrvApp *>(mItsService);
    if(pRmtCfgSrvApp!=NIL)
    {
        SetStatus(pRmtCfgSrvApp->GetAckStatus());
    }
    
    
    
    //#]
}

/**
* \brief SetStatus: Set the ack status
*
* \note
*
* \param[in]
* - status: the ack status shall be set
*
* \return
* - none
*
*/
void tlmRmtCfgDataInfoAck::SetStatus(uint8_t status) {
    //#[ operation SetStatus(uint8_t)
    mStatus=status;
    //#]
}

